package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: Anbu
 * Date: 9/23/13
 * Time: 4:39 PM
 * To change this template use File | Settings | File Templates.
 */
public class User {

    private String userId;
    private String password;
    private UserDetails userDetails;

    public User(String userId, String password, UserDetails userDetails) {
        this.userId = userId;
        this.password = password;
        this.userDetails = userDetails;
    }

    public boolean checkPassword(String password) {
        return this.password.equals(password);
    }

    public String getUserId() {
        return userId;
    }

    public String getUserName() {
        return userDetails.getName();
    }

    public String getEmailAddress() {
        return userDetails.getEmailAddress();
    }

    public int getPhoneNumber() {
        return userDetails.getPhoneNumber();
    }

    public String toString() {
        return "Name : " + getUserName() + "\nEmail : " + getEmailAddress() + "\nPhone : " + getPhoneNumber();
    }

    public static User getNullUser() {
        return new NullUser();
    }
}
